<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <title>左右两侧固定列，中间内容可以横向拖动</title>
    <link rel="stylesheet" href="../../css/fixed-table.css" />
    <script src="../jquery/jquery-1.12.4.min.js"></script>
    <script src="../../js/fixed-table.js"></script>
    <style>
        .fixed-table-box{
            width: 800px;
            margin: 50px auto;
        }
        .fixed-table-box>.fixed-table_body-wraper{/*内容了表格主体内容有纵向滚动条*/
            max-height: 260px;
        }
        
        .fixed-table_fixed>.fixed-table_body-wraper{/*为了让两侧固定列能够同步表格主体内容滚动*/
            max-height: 240px;
        }

        .w-150{
            width: 150px;
        }
        .w-120{
            width: 120px;
        }
        .w-300{
            width: 300px;
        }
        .w-100{
            width: 100px;
        }
        .btns{
            text-align: center;
        }
        .btns button{
            padding: 10px 20px;
        }
    </style>
</head>
<body>
    <div class="fixed-table-box row-col-fixed">
        <!-- 表头 start -->
        <div class="fixed-table_header-wraper">
            <table class="fixed-table_header" cellspacing="0" cellpadding="0" border="0">
                <thead>
                    <tr>
                        <th class="w-150" data-fixed="true"><div class="table-cell">日期</div></th>
                        <th class="w-120"><div class="table-cell">姓名</div></th>
                        <th class="w-120"><div class="table-cell">省份</div></th>
                        <th class="w-120"><div class="table-cell">市区</div></th>
                        <th class="w-300"><div class="table-cell">地址</div></th>
                        <th class="w-120"><div class="table-cell">邮编</div></th>
                        <th class="w-100" data-fixed="true" data-direction="right"><div class="table-cell">操作</div></th>
                    </tr>
                </thead>
            </table>
        </div>
        <!-- 表头 end -->
        <!-- 表格内容 start -->
        <div class="fixed-table_body-wraper">
            <table class="fixed-table_body" cellspacing="0" cellpadding="0" border="0">
                <tbody>
                    <tr>
                        <td class="w-150"><div class="table-cell"> 2016-05-03</div></td>
                        <td class="w-120"><div class="table-cell">王小虎1</div></td>
                        <td class="w-120"><div class="table-cell">上海</div></td>
                        <td class="w-120"><div class="table-cell">普陀区</div></td>
                        <td class="w-300"><div class="table-cell">上海市普陀区金沙江路 1518 路</div></td>
                        <td class="w-120"><div class="table-cell">200333</div></td>
                        <td class="w-100">
                            <div class="table-cell">
                                <a href="###">查看</a>
                                <a href="###">编辑</a>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="w-150"><div class="table-cell"> 2016-05-03</div></td>
                        <td class="w-120"><div class="table-cell">王小虎2</div></td>
                        <td class="w-120"><div class="table-cell">上海</div></td>
                        <td class="w-120"><div class="table-cell">普陀区</div></td>
                        <td class="w-300"><div class="table-cell">上海市普陀区金沙江路 1518 路</div></td>
                        <td class="w-120"><div class="table-cell">200333</div></td>
                        <td class="w-100">
                            <div class="table-cell">
                                <a href="###">查看</a>
                                <a href="###">编辑</a>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="w-150"><div class="table-cell"> 2016-05-03</div></td>
                        <td class="w-120"><div class="table-cell">王小虎3</div></td>
                        <td class="w-120"><div class="table-cell">上海</div></td>
                        <td class="w-120"><div class="table-cell">普陀区</div></td>
                        <td class="w-300"><div class="table-cell">上海市普陀区金沙江路 1518 路</div></td>
                        <td class="w-120"><div class="table-cell">200333</div></td>
                        <td class="w-100">
                            <div class="table-cell">
                                <a href="###">查看</a>
                                <a href="###">编辑</a>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="w-150"><div class="table-cell"> 2016-05-03</div></td>
                        <td class="w-120"><div class="table-cell">王小虎4</div></td>
                        <td class="w-120"><div class="table-cell">上海</div></td>
                        <td class="w-120"><div class="table-cell">普陀区</div></td>
                        <td class="w-300"><div class="table-cell">上海市普陀区金沙江路 1518 路</div></td>
                        <td class="w-120"><div class="table-cell">200333</div></td>
                        <td class="w-100">
                            <div class="table-cell">
                                <a href="###">查看</a>
                                <a href="###">编辑</a>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="w-150"><div class="table-cell"> 2016-05-03</div></td>
                        <td class="w-120"><div class="table-cell">王小虎5</div></td>
                        <td class="w-120"><div class="table-cell">上海</div></td>
                        <td class="w-120"><div class="table-cell">普陀区</div></td>
                        <td class="w-300"><div class="table-cell">上海市普陀区金沙江路 1518 路</div></td>
                        <td class="w-120"><div class="table-cell">200333</div></td>
                        <td class="w-100">
                            <div class="table-cell">
                                <a href="###">查看</a>
                                <a href="###">编辑</a>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="w-150"><div class="table-cell"> 2016-05-03</div></td>
                        <td class="w-120"><div class="table-cell">王小虎</div></td>
                        <td class="w-120"><div class="table-cell">上海</div></td>
                        <td class="w-120"><div class="table-cell">普陀区</div></td>
                        <td class="w-300"><div class="table-cell">上海市普陀区金沙江路 1518 路</div></td>
                        <td class="w-120"><div class="table-cell">200333</div></td>
                        <td class="w-100">
                            <div class="table-cell">
                                <a href="###">查看</a>
                                <a href="###">编辑</a>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="w-150"><div class="table-cell"> 2016-05-03</div></td>
                        <td class="w-120"><div class="table-cell">王小虎</div></td>
                        <td class="w-120"><div class="table-cell">上海</div></td>
                        <td class="w-120"><div class="table-cell">普陀区</div></td>
                        <td class="w-300"><div class="table-cell">上海市普陀区金沙江路 1518 路</div></td>
                        <td class="w-120"><div class="table-cell">200333</div></td>
                        <td class="w-100">
                            <div class="table-cell">
                                <a href="###">查看</a>
                                <a href="###">编辑</a>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="w-150"><div class="table-cell"> 2016-05-03</div></td>
                        <td class="w-120"><div class="table-cell">王小虎</div></td>
                        <td class="w-120"><div class="table-cell">上海</div></td>
                        <td class="w-120"><div class="table-cell">普陀区</div></td>
                        <td class="w-300"><div class="table-cell">上海市普陀区金沙江路 1518 路</div></td>
                        <td class="w-120"><div class="table-cell">200333</div></td>
                        <td class="w-100">
                            <div class="table-cell">
                                <a href="###">查看</a>
                                <a href="###">编辑</a>
                            </div>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <!-- 表格内容 end -->

        <!-- 固定列 start -->
        <div class="fixed-table_fixed fixed-table_fixed-left">
            <div class="fixed-table_header-wraper">
                <table class="fixed-table_header" cellspacing="0" cellpadding="0" border="0">
                    <thead>
                        <tr>
                            <th class="w-150"><div class="table-cell">日期</div></th>
                        </tr>
                    </thead>
                </table>
            </div>
            
            <div class="fixed-table_body-wraper">
                <table class="fixed-table_body" cellspacing="0" cellpadding="0" border="0">
                    <tbody>
                        <tr>
                            <td class="w-150"><div class="table-cell"> 2016-05-03</div></td>
                        </tr>
                        <tr>
                            <td class="w-150"><div class="table-cell"> 2016-05-03</div></td>
                        </tr>
                        <tr>
                            <td class="w-150"><div class="table-cell"> 2016-05-03</div></td>
                        </tr>
                        <tr>
                            <td class="w-150"><div class="table-cell"> 2016-05-03</div></td>
                        </tr>
                        <tr>
                            <td class="w-150"><div class="table-cell"> 2016-05-03</div></td>
                        </tr>
                        <tr>
                            <td class="w-150"><div class="table-cell"> 2016-05-03</div></td>
                        </tr>
                        <tr>
                            <td class="w-150"><div class="table-cell"> 2016-05-03</div></td>
                        </tr>
                        <tr>
                            <td class="w-150"><div class="table-cell"> 2016-05-03</div></td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
        <div class="fixed-table_fixed fixed-table_fixed-right">
            <div class="fixed-table_header-wraper">
                <table class="fixed-table_header" cellspacing="0" cellpadding="0" border="0">
                    <thead>
                        <tr>
                            <th class="w-100"><div class="table-cell">操作</div></th>
                        </tr>
                    </thead>
                </table>
            </div>
            
            <div class="fixed-table_body-wraper">
                <table class="fixed-table_body" cellspacing="0" cellpadding="0" border="0">
                    <tbody>
                        <tr>
                            <td class="w-100">
                                <div class="table-cell">
                                    <a href="###">查看</a>
                                    <a href="###">编辑</a>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="w-100">
                                <div class="table-cell">
                                    <a href="###">查看</a>
                                    <a href="###">编辑</a>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="w-100">
                                <div class="table-cell">
                                    <a href="###">查看</a>
                                    <a href="###">编辑</a>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="w-100">
                                <div class="table-cell">
                                    <a href="###">查看</a>
                                    <a href="###">编辑</a>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="w-100">
                                <div class="table-cell">
                                    <a href="###">查看</a>
                                    <a href="###">编辑</a>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="w-100">
                                <div class="table-cell">
                                    <a href="###">查看</a>
                                    <a href="###">编辑</a>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="w-100">
                                <div class="table-cell">
                                    <a href="###">查看</a>
                                    <a href="###">编辑</a>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="w-100">
                                <div class="table-cell">
                                    <a href="###">查看</a>
                                    <a href="###">编辑</a>
                                </div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
        <!-- 固定列 end -->
    </div>

    <div class="btns">
        <button type="button" id="delRow1">删除第二行(方式一)</button>
        <button type="button" id="delRow2">删除第二行(方式二)</button>
        <button type="button" id="delRow3">删除第二行(方式三)</button>
    </div>

    <script>
        //初始化FixedTable
        $(".fixed-table-box").fixedTable();

        $("#delRow1").on("click", function (){
            $(".fixed-table-box").deleteRow(1);
        });
        $("#delRow2").on("click", function (){
            $(".fixed-table-box").deleteRow($(".fixed-table-box>.fixed-table_body-wraper tr").get(1));
        });
        $("#delRow3").on("click", function (){
            $(".fixed-table-box").deleteRow($(".fixed-table-box>.fixed-table_body-wraper tr").eq(1));
        });
        
    </script>
</body>
</html>